package cn.org.timespace.ons.service.base.impl;

import java.util.ArrayList;
import java.util.List;

import cn.org.timespace.ons.action.base.MachinesApplyModel;
import cn.org.timespace.ons.dao.base.MachinesApplyDao;
import cn.org.timespace.ons.service.base.MachinesApplyService;
import cn.org.timespace.ons.util.pager.Pager;
import cn.org.timespace.ons.vo.base.AppleServer;
import cn.org.timespace.ons.vo.base.MachinesApply;
import cn.org.timespace.ons.vo.base.Options;

public class MachinesApplyServiceImpl implements MachinesApplyService {
	
	private MachinesApplyDao machinesApplyDao;

	@Override
	public void delete(MachinesApply persistentInstance) {
		// TODO Auto-generated method stub

	}

	@Override
	public List<MachinesApply> findByCondition(MachinesApplyModel model) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByCondition(model);
	}

	@Override
	public List<Object> findByCondition(MachinesApplyModel model, Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByCondition(model,p);
	}

	@Override
	public MachinesApply findById(String id) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findById(id);
	}

	@Override
	public boolean save(MachinesApply transientInstance) {
		return machinesApplyDao.save(transientInstance);

	}

	@Override
	public void update(MachinesApply instance) {
		machinesApplyDao.update(instance);

	}

	public MachinesApplyDao getMachinesApplyDao() {
		return machinesApplyDao;
	}

	public void setMachinesApplyDao(MachinesApplyDao machinesApplyDao) {
		this.machinesApplyDao = machinesApplyDao;
	}

	@Override
	public List<Object> findByMachineId(String machineId, Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByMachineId(machineId, p);
	}

	@Override
	public List<Object> findByStartName(String startName , Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByStartName(startName, p);
	}
	public List<Object> findApplyAndAuditByCondition(MachinesApply  model, Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findApplyAndAuditByCondition(model, p);
	}
	
	//根据应用平台ID查找信息终端
	@Override
	public List<Object> findByApplyId(String machineId, Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByApplyId(machineId, p);
	}

	@Override
	public List<AppleServer> findByMsidAndName(String id, String name, Pager p) {
		// TODO Auto-generated method stub
		return machinesApplyDao.findByMsidAndName(id , name ,p);
	}

	@Override
	public List<Options> findByAppIdAndName(String asid, String name, Pager p) {
		// TODO Auto-generated method stub
		 return machinesApplyDao.findByAppIdAndName(asid, name, p);
	}
	
	public List<Object> findByApplyByAudit(String msid,String theIdMachine,String userName) {
		return machinesApplyDao.findByApplyByAudit(msid,theIdMachine,userName);
	}

	public List<Object> findByApplyByAsAudit(String mid,String theIdMachine) {
		return machinesApplyDao.findByApplyByAsAudit(mid,theIdMachine);
	}
	
	public void deleteByMachinesId(String  machinesId){
		machinesApplyDao.deleteByMachinesId(machinesId);
	}
	
	/**
	 * 根据信息终端的组合ID,查询出已经申请的应用
	 * @param machinesID
	 * @return
	 */
	public ArrayList<AppleServer> findAppleServerByMachinesID(String machinesID){
		return machinesApplyDao.findAppleServerByMachinesID(machinesID);
	}
	
	public List<Object> findByApplyByAuditNew(String theIdMachine,String userName) {
		return machinesApplyDao.findByApplyByAuditNew(theIdMachine,userName);
	}

	@Override
	public String findByMsid(String id) {
		// TODO Auto-generated method stub
		return this.machinesApplyDao.findByMsid(id);
	}

	@Override
	public String findByAsid(String asid) {
		// TODO Auto-generated method stub
		return this.machinesApplyDao.findByAsid(asid);
	}
}
